package com.ruoyi.system.service.impl;

import java.util.List;

import com.ruoyi.common.annotation.DataSource;
import com.ruoyi.common.enums.DataSourceType;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.system.mapper.DeskAnswerMapper;
import com.ruoyi.system.domain.DeskAnswer;
import com.ruoyi.system.service.IDeskAnswerService;

/**
 * 答案Service业务层处理
 * 
 * @author ruoyi
 * @date 2023-06-07
 */
@Service
public class DeskAnswerServiceImpl implements IDeskAnswerService 
{
    @Autowired
    private DeskAnswerMapper deskAnswerMapper;

    /**
     * 查询答案
     * 
     * @param id 答案主键
     * @return 答案
     */
    @Override
    public DeskAnswer selectDeskAnswerById(Long id)
    {
        return deskAnswerMapper.selectDeskAnswerById(id);
    }

    @Override
    @DataSource(value = DataSourceType.SLAVE)
    public DeskAnswer selectDeskAnswerByType(Long id)
    {
        return deskAnswerMapper.selectDeskAnswerByType(id);
    }

    /**
     * 查询答案列表
     * 
     * @param deskAnswer 答案
     * @return 答案
     */
    @Override
    public List<DeskAnswer> selectDeskAnswerList(DeskAnswer deskAnswer)
    {
        return deskAnswerMapper.selectDeskAnswerList(deskAnswer);
    }

    /**
     * 新增答案
     * 
     * @param deskAnswer 答案
     * @return 结果
     */
    @Override
    public int insertDeskAnswer(DeskAnswer deskAnswer)
    {
        return deskAnswerMapper.insertDeskAnswer(deskAnswer);
    }

    /**
     * 修改答案
     * 
     * @param deskAnswer 答案
     * @return 结果
     */
    @Override
    public int updateDeskAnswer(DeskAnswer deskAnswer)
    {
        return deskAnswerMapper.updateDeskAnswer(deskAnswer);
    }

    /**
     * 批量删除答案
     * 
     * @param ids 需要删除的答案主键
     * @return 结果
     */
    @Override
    public int deleteDeskAnswerByIds(Long[] ids)
    {
        return deskAnswerMapper.deleteDeskAnswerByIds(ids);
    }

    /**
     * 删除答案信息
     * 
     * @param id 答案主键
     * @return 结果
     */
    @Override
    public int deleteDeskAnswerById(Long id)
    {
        return deskAnswerMapper.deleteDeskAnswerById(id);
    }
}
